package 书店销售管理系统;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Map;

public class UserRedis {

    public static void main(String[] args) {
   
        Jedis jedis = new Jedis("redis://127.0.0.1:6379");

        // 插入数据
        Map<String, String> userInfo = new HashMap<>();
        userInfo.put("tom", "0123456");
        userInfo.put("Lion", "1234567");
        userInfo.put("Der", "D12345");
        userInfo.put("Monkey", "M123456");
        jedis.hmset("USER1", userInfo);

        // 查询数据
        Map<String, String> userInfoFromRedis = jedis.hgetAll("USER1");
        System.out.println(userInfoFromRedis);

        // 关闭 Jedis 实例
        jedis.close();
    }

}
